package study.edumanagesystemspringboot.entity;

import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @author zouran
 * createDate：2023/12/26  0:34
 */
@Data
public class Department implements Serializable {
    private final List<Person> personList = new ArrayList<>();

    public Department() {
    }

    public Department(List<Teacher> teachers, List<Student> students) {
        personList.addAll(teachers);
        personList.addAll(students);
    }

    public List<Map<String, Object>> information(Visitor visitor) {
        List<Map<String, Object>> maps = new ArrayList<>();
        for (Person person : personList) {
            maps.add(person.accept(visitor));
        }
        return maps;
    }
}
